package com.producteev4j.services.version0;

import com.producteev4j.transport.ProducteevTransport;
import com.producteev4j.exceptions.ProducteevException;
import com.producteev4j.model.response.*;

import java.util.Date;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: jcarrey
 * Date: 18/05/11
 * Time: 12:25
 * To change this template use File | Settings | File Templates.
 */
public interface ProducteevTaskService {

    Task createTask(ProducteevTransport transport, String userToken, String title, Long idResponsible,
                    Long idDashboard, String deadline, Integer allDay, Integer reminder, Integer status,
                    Integer star, String repeatinginterval, Integer repeatingValue, Long[] idLabel) throws ProducteevException;

    List<? extends TaskWrapper> getTasks(ProducteevTransport transport, String userToken, Date since, Long dashboard, Integer page) throws ProducteevException;

    Task getTask(ProducteevTransport transport, String userToken, long taskId) throws ProducteevException;


    public List<? extends UserWrapper> getTaskAccessControlList(ProducteevTransport transport, String userToken, long idTask) throws ProducteevException;

    public boolean deleteTask(ProducteevTransport transport, String userToken, long idTask) throws ProducteevException;

    /**
     * unset the deadline
     *
     * @param transport
     * @param userToken
     * @param idTask
     * @return
     * @throws ProducteevException
     */
    public Task unsetTaskRepeating(ProducteevTransport transport, String userToken, long idTask) throws ProducteevException;


    /**
     * @param transport
     * @param userToken
     * @param idTask
     * @param repeatingInterval - day(s), weekday(s), week(s), month(s) and year(s)
     * @param repeatingValue    - (Optional) Number of days
     * @return
     * @throws ProducteevException
     */
    public Task setTaskRepeating(ProducteevTransport transport, String userToken, long idTask, String repeatingInterval, Integer repeatingValue) throws ProducteevException;

    /**
     * @param transport
     * @param userToken
     * @param idTask
     * @param idReminder - (0 = "None", 1 = "5 minutes before", 2 = "15 minutes before", 3 = "30 minutes before", 4 = "1 hour before", 5 = "2 hours before", 6 = "1 day before", 7 = "2 days before", 8 = "on date of event")
     * @return
     * @throws ProducteevException
     */
    public Task setTaskReminder(ProducteevTransport transport, String userToken, long idTask, int idReminder) throws ProducteevException;

    /**
     * unset the deadline
     *
     * @param transport
     * @param userToken
     * @param idTask
     * @return
     * @throws ProducteevException
     */
    public Task unsetTaskDeadline(ProducteevTransport transport, String userToken, long idTask) throws ProducteevException;


    /**
     * @param transport
     * @param userToken
     * @param idTask
     * @param deadline
     * @param allDay    =1 -> deadline ignored, =0 -> the deadline
     * @return
     */
    public Task setTaskDeadline(ProducteevTransport transport, String userToken, long idTask, Date deadline, boolean allDay) throws ProducteevException;

    /**
     * @param transport
     * @param userToken
     * @param idTask
     * @param idResponsible - Number of stars from 0 to 5
     * @return
     * @throws ProducteevException
     */
    public Task unsetTaskResponsible(ProducteevTransport transport, String userToken, long idTask, long idResponsible) throws ProducteevException;

    /**
     * @param transport
     * @param userToken
     * @param idTask
     * @param idResponsible - Number of stars from 0 to 5
     * @return
     * @throws ProducteevException
     */
    public Task setTaskResponsible(ProducteevTransport transport, String userToken, long idTask, long idResponsible) throws ProducteevException;

    /**
     * @param transport
     * @param userToken
     * @param idTask
     * @param stars     - Number of stars from 0 to 5
     * @return
     * @throws ProducteevException
     */
    public Task setTaskStars(ProducteevTransport transport, String userToken, long idTask, int stars) throws ProducteevException;

    /**
     * @param transport
     * @param userToken
     * @param title
     * @return
     * @throws ProducteevException
     */
    Task setTaskTitle(ProducteevTransport transport, String userToken, long idTask, String title) throws ProducteevException;

    Task setTaskStatus(ProducteevTransport transport, String userToken, long idTask, int status) throws ProducteevException;

    /**
     * Returns 200 tasks
     *
     * @param transport
     * @param userToken
     * @param since
     * @param dashboard
     * @param page      - Not yet used (See documentation)
     * @return
     * @throws ProducteevException
     */
    List<? extends TaskWrapper> getArchivedTasks(ProducteevTransport transport, String userToken, Date since, Long dashboard, Integer page) throws ProducteevException;

    List<? extends TaskWrapper> getMyTeamTasks(ProducteevTransport transport, String userToken, Date since, Long dashboard, Integer page) throws ProducteevException;

    List<? extends TaskWrapper> getMyTasks(ProducteevTransport transport, String userToken, Date since, Long dashboard, Integer page) throws ProducteevException;

    List<? extends LabelWrapper> getTaskLabels(ProducteevTransport transport, String userToken, long idTask) throws ProducteevException;

    Task changeTaskLabels(ProducteevTransport transport, String userToken, long idTask, Long[] idLabels) throws ProducteevException;

    // List<? extends UserWrapper> getTaskUserList(ProducteevTransport transport, String userToken, long idTask) throws ProducteevException;

    public Task setTaskWorkspace(ProducteevTransport transport, String userToken, long idTask, long idDashboard) throws ProducteevException;

    Note getNote(ProducteevTransport transport, String userToken, long idNote) throws ProducteevException;

    List<? extends NoteWrapper> getTaskNotes(ProducteevTransport transport, String userToken, long idTask, Date since) throws ProducteevException;


    /**
     * 100 activities/page
     *
     * @param transport
     * @param userToken
     * @param idTask
     * @param page      - statrts at 1
     * @throws ProducteevException
     */
    public List<? extends ActivityWrapper> getTaskActivity(ProducteevTransport transport, String userToken, long idTask, Integer page) throws ProducteevException;

    public Activity getActivity(ProducteevTransport transport, String userToken, long idActivity) throws ProducteevException;

    public boolean deleteNote(ProducteevTransport transport, String userToken, long idNote) throws ProducteevException;

    public Note createNote(ProducteevTransport transport, String userToken, long idTask, String message) throws ProducteevException;
}